package Facade;

import SubSystem.AirCondition;
import SubSystem.Light;
import SubSystem.TV;
import lombok.Data;

@Data
public class SmartAppFacade {

    private Light light;
    private TV tv;
    private AirCondition airCondition;

    public SmartAppFacade(){
        light = new Light();
        tv = new TV();
        airCondition = new AirCondition();
    }

    //通过语音控制
    public void say(String message){
        if(message.contains("打开")){
            on();
            return;
        }
        if(message.contains("关闭")){
            off();
            return;
        }
        System.out.println("听不懂");
    }

    void on(){
        light.on();
        tv.on();
        airCondition.on();
    }

    void off(){
        light.off();
        tv.off();
        airCondition.off();
    }
}
